<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link href="../jqueryNicepage/css/layui.css" type="text/css" rel="stylesheet">
    <link rel="stylesheet" href="../styles/common.css"/>
    <link rel="stylesheet" href="../styles/base.css"/>
    <link rel="stylesheet" href="../styles/font/iconfont.css"/>
    <style >
        #table2 table thead{
            "background":"#f2f2f2",
        }
    </style>
</head>

<BODY>
<center style="">
    <div style="width: 99%;">

        <div id="table2"></div>
        <div id="pageBar2"></div>
    </div>

</center>
</body>
<!--<script type="text/javascript" src="../js/jquery-1.11.3.min.js"></script>-->
<script language="Javascript" src="../jqueryNicepage/js/layui.js"></script>
<script language="Javascript" src="../jqueryNicepage/js/singleNicePage.js"></script>
<script LANGUAGE="javascript">
    var check="false";
    var flage=true;
    //标准json格式 目前只支持[{a:b,c:d},{a:b,c:d}]此种格式
    var dataListObj=[];
    var json1 =window.historyList1;
    var nameList1= window.headers1 //table的列名
    var widthList1 = window.widths1//table每列的宽度
    $(function () {
        window.nicePage = {
            table: "div",
            bar: "bar",
            limit: "10",
            color: "#1E9FFF",
            layout: ["count", "prev", "page", "next", "limit", "skip"],
            setCfg: function(b) {
                nicePage.table = b.table;
                nicePage.bar = b.bar;
                nicePage.limit = b.limit;
                nicePage.color = b.color;
                nicePage.layout = b.layout
            },
            returnHtml: function(g, e) {
                var h = '<table class="layui-table" lay-size="sm"><colgroup>';
                for (var f in e) {
                    h += " <col width=" + e[f] + ">"
                }
                h += " </colgroup><thead><tr>";

                for (var f in g) {
                    h += "  <th>" + g[f] + "</th>"
                }
                h += " </tr></thead> <tbody>";
                return h
            },
            returnList: function(j) {
                var h = new Array();
                for (var f in j) {
                    var i = "";
                    for (var g in j[f]) {
                        i += j[f][g] + ";"
                    }
                    i = i.substring(0, i.length - 1);
                    h.push(i)
                }
                return h
            },
            returnTable: function(index,e) {
                var h = e.split(";");
                var g = "<tr><td class='serialNumber'>"+index+"</td>";
                for (var f in h) {
                    g += "<td class='td"+f+"'>"+h[f]+"</td>"
                }
                g += "<td class='operationClick' data-checked=true><i title='查看' class='iconfont'>&#xe64c;</i></td></tr>";
                return g
            }
        };
        nicePage.setCfg({
            cont: $('#pageBar2,#pageBar'),
            table: 'table2',
            bar: 'pageBar2',
            limit: 30,
            color: '#1E9FFF',
            layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
        });

        layui.use("laypage", function() {
            var a = layui.laypage;
            var table = layui.table;
            a.render({
                elem: nicePage.bar,
                limit: nicePage.limt,
                theme: nicePage.color,
                count: json1.length,
                layout: nicePage.layout,
                jump: function(w) {
                    document.getElementById(nicePage.table).innerHTML = function() {
                        var c = [nicePage.returnHtml(nameList1, widthList1)],
                                d = nicePage.returnList(json1).concat().splice(w.curr * w.limit - w.limit, w.limit);
                        layui.each(d, function(index, g) {
                            var f = nicePage.returnTable(index+1,g);
                            c.push(f)
                        });
                        c.push(" </tbody></table></br>");
                        return c.join("")
                    }()
                }
            })

        })
    });

    //初始化完成
    $("body").unbind("click").on("click","tbody tr .operationClick",function() {
        if(window.reportQuery!=undefined&&window.reportQuery=="true"){
            var otr=$(this).parents("tr")[0];
            var num=$(otr).find(".td0 ").text();//econumber;
            var view= $(otr).find(".td1").text();
            window.open("reportHistory.html?econumber="+num);
        }else{
            var otr=$(this).parents("tr")[0];
            var num=$(otr).find(".td1").text();//ECO编号;
            var effNum=$(otr).find(".td0").text()//成品编码
            var view= $(otr).find(".td3").text();//视图
            window.open("reportEco.html?econumber="+num+"&num="+effNum+"&view="+view);
        }

    })
</script>

</html>